package com.itheima.service;

import com.itheima.dao.impl.BookDaoImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;


public class BookService {

    BookDaoImpl bookDao;

    public void setBookDao(BookDaoImpl bookDao) {
        this.bookDao = bookDao;
    }

    public void checkout(String username,String isbn){
        //减库存
        bookDao.updateStock(isbn);
        //减余额
		//int i = 1/0;
        int price = bookDao.getPrice(isbn);
        bookDao.updateBalance(username, price);

    }
}
